﻿<%@ page contentType="text/html; charset=UTF-8" language="java"%>

<%@page import="com.books4sale.admin.dto.tools.Helper"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.books4sale.admin.dto.Book"%>
<%@page import="java.util.List"%><html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<div class="top-bar"><a class="button" style="cursor: pointer">إضافة
كتاب جديد </a>
<h1>الكتب المتوفرة</h1>
<div class="breadcrumbs"></div>
</div>
<div class="select-bar"><label> <input type="text"
	name="textfield" /> </label> <label> <input type="submit"
	name="Submit" value="Search" /> </label></div>
<div class="table" style="height: 250px; overflow: hiddem;">
<table class="listing" cellpadding="0" cellspacing="0">
	<tr>
		<th>اسم الكتاب</th>
		<th>الكلية</th>
		<th>المادّة</th>
		<th>السعر - شيكل</th>
		<th style="display: none">id</th>
		<th style="display: none">rowIndex</th>
		<th>حذف</th>
		<th>تعديل</th>

	</tr>
	<tbody id="listingBody">
		<%
		List<Book> books = Helper.get().getPageData(1);
		for(int i=0; i< books.size(); i++){
			Book book = books.get(i);
			out.print("<tr>");
			out.print("	<td class='style2'>"+book.getBookName()+"</td>");
			out.print("	<td width='177' class='style2'>"+book.getBookCollage()+"</td>");
			out.print("	<td width='177' class='style2'>"+book.getBookSubject()+"</td>");
			out.print("	<td width='177' class='style2'>"+book.getBookPrice()+"</td>");
			out.print("	<td style='display: none'>"+book.getId().getId()+"</td>");
			out.print("	<td style='display: none' class='rowIndex'>"+(i+1)+"</td>");
			out.print("	<td width='16'><img class='deleteButton' src='img/hr.gif'");
			out.print("		width='16' height='16' alt='' onclick='deleteBook(this);'/></td>");
			out.print("	<td width='16'><img class='editButton' src='img/edit-icon.gif'");
			out.print("		width='16' height='16' alt='edit' onclick='editBookInfo(this)' /></td>");
			out.print("</tr>");
		}
		%>
	</tbody>

</table>
<div id="navigator" class="select"><strong>اذهب إلى صفحة:</strong> <select>
	<option>1</option>
	<option>2</option>
	<option>3</option>
</select></div>
</div>

</body>
<script type="text/javascript">
$(function(){
	$("#navigator").change(function(){
		var selectedPage = $("#navigator select option:selected").text();
		getPageData(selectedPage);
		});
	$("a.button").click(function(){
						bookFormOperation = "add";
						clearBookInfoFields();
						$dialog.dialog('open');
						return false;											
						});
	updateRowIndexes();
});
</script>
</html>